package com.mark.spring.annotation.life.cycle.postconstruct;

import javax.annotation.PostConstruct;

/**
 * @Description: 歌手
 * @Author: Mark
 * @CreateDate: 2019/9/17 21:09
 * @Version: 3.00.001
 * @Copyright : 豆浆油条个人非正式工作室
 */
public class Singer {

    private String name;
    private String song;

    public Singer(){
        System.out.println("Singer constructor");
    }

    /**
     * 对象创建并赋值后调用
     */
    @PostConstruct
    public void init(){
        System.out.println("Singer....PostConstruct()"+name+"发布了新歌 "+song);
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSong() {
        return song;
    }

    public void setSong(String song) {
        this.song = song;
    }

    @Override
    public String toString() {
        return "Singer{" +
                "name='" + name + '\'' +
                ", song='" + song + '\'' +
                '}';
    }
}
